import request from '@/api/request.js'
// 机构列表
export const getDepartmentList = (params) => {
  return request({
    url: 'department/v_list',
    method: 'GET',
    params
  })
}

// id查询某条机构记录
export const getDepartmentDetail = (params) => {
  return request({
    url: `department/show_detail?id=${params.id}`,
    method: 'GET'
  })
}

// 添加
export const insertDepartment = (data) => {
  return request({
    url: 'department/o_save',
    method: 'POST',
    data
  })
}

// 添加
export const updateDepartment = (data) => {
  return request({
    url: 'department/o_update',
    method: 'POST',
    data
  })
}

// 获取栏目权限信息
export const getChannelsAdd = () => {
  return request({
    url: 'department/v_channels_add',
    method: 'GET'
  })
}

// 查询上层机构名称
export const getUpperName = (tier) => {
  return request({
    url: `/department/show_detail_upper?tier=${tier}`,
    method: 'GET'
  })
}

// 禁用
export const disableDepartment = (data) => {
  return request({
    url: '/department/o_disable',
    method: 'DELETE',
    data
  })
}

// 删除
export const deleteDepartment = (params) => {
  return request({
    url: '/department/o_delete',
    method: 'DELETE',
    params
  })
}

// 获取省份
export const getProvince = () => {
  return request({
    url: '/department/v_addProvince',
    method: 'GET'
  })
}
